{include file="public/header" /}


<style>
    td .block-area {
        border: 1px solid #f3f3f3;
        padding: 0 10px;
    }
    td .block-area + .block-area {
        margin-top: 5px;
    }
</style>


<div class="page">
    <div class="fixed-bar">
        <div class="item-title">
            <div class="subject">
                <h3>线下订单</h3>
                <h5></h5>
            </div>
            {include file="public/admin_items" /}
        </div>
    </div>
    <form method="get">
        <div class="sc-search-form">
            <dl>
                <dt>{$Think.lang.order_state}</dt>
                <dd>
                    <select name="order_state" class="querySelect">
                        <option value="">{$Think.lang.sc_please_choose}</option>
                        <option value="10" {if condition="$Request.param.order_state eq '10'"}selected{/if}>{$Think.lang.order_state_new}</option>
                        <option value="20" {if condition="$Request.param.order_state eq '20'"}selected{/if}>{$Think.lang.order_state_pay}</option>
                        <option value="30" {if condition="$Request.param.order_state eq '30'"}selected{/if}>{$Think.lang.order_state_send}</option>
                        <option value="40" {if condition="$Request.param.order_state eq '40'"}selected{/if}>{$Think.lang.order_state_success}</option>
                        <option value="0" {if condition="$Request.param.order_state eq '0'"}selected{/if}>{$Think.lang.order_state_cancel}</option>
                    </select>
                </dd>
            </dl>
            <dl>
                <dt>支付方式</dt>
                <dd>
                    <select name="payment_code">
                        <option value="">{$Think.lang.sc_please_choose}</option>
                        {foreach $payment_list as $val}
                        <option {if condition="$Request.param.payment_code eq $val.payment_code"}selected{/if} value="{$val.payment_code}">{$val.payment_name}</option>
                        {/foreach}
                    </select>
                </dd>
            </dl>
            <dl>
                <dt>发货类型</dt>
                <dd>
                    {sctaglib:dcselect list=":dict_get('trade_mode')" class="w-100" name="trade_mode" value="$Request.param.trade_mode" default="全部" /}
                </dd>
            </dl>
            <dl>
                <dt>仓库状态</dt>
                <dd>
                    {sctaglib:dcselect list=":dict_get('wms_state')" class="w-100" name="wms_state" value="$Request.param.wms_state" default="全部" /}
                </dd>
            </dl>
            <dl>
                <dt>单一窗口状态</dt>
                <dd>
                    {sctaglib:dcselect list=":dict_get('customs_state')" class="w-100" name="customs_state" value="$Request.param.customs_state" default="全部" /}
                </dd>
            </dl>
        </div>
        <div class="sc-search-form">
            <dl>
                <dt>{$Think.lang.order_number}</dt>
                <dd><input type="text" class="text w150" name="order_sn" value="{$Request.param.order_sn}"></dd>
            </dl>
            <dl>
                <dt>{$Think.lang.order_time}</dt>
                <dd>
                    <input type="text" class="txt date" name="query_start_time" id="query_start_time" value="{$Request.param.query_start_time}">
                        &nbsp;–&nbsp;
                        <input id="query_end_time" class="txt date" type="text" name="query_end_time" value="{$Request.param.query_end_time}">
                </dd>
            </dl>
            <dl>
                <dt>{$Think.lang.buyer_name}</dt>
                <dd>
                    <!--<input type="text" class="text w80" name="buyer_name" value="{$Request.param.buyer_name}">-->
                    {sctaglib:dcselect list="[$Request.param.buyer_name=>$Request.param.buyer_name]" class="w-100 sc-select-filter form-control" name="buyer_name" value="$Request.param.buyer_name" default="-- --" url=":url('dictionary/query',['dict_type'=>'member_name'])" /}
                </dd>
            </dl>
            <div class="btn_group">
                <input type="submit" class="btn" value="搜索">
                {if $filtered}
                <a href="{:url('Order/offline_order')}" class="btn btn-default" title="{$Think.lang.sc_cancel}">{$Think.lang.sc_cancel}</a>
                {/if}
                <!--<a class="btn btn-mini" href="javascript:export_xls('{:url('Order/export_step1')}')"><span>{$Think.lang.sc_export}Excel</span></a>-->
                <a class="btn btn-mini download-excel" href="javascript:void(0);"><span>{$Think.lang.sc_export}Excel</span></a>

                <a id="fullscreen" class="btn btn-mini" href="javascript:top.scLayerOpenFull('{:url('Order/create_offline_order')}','添加线下订单')"><span>添加线下订单</span></a>
            </div>
        </div>
    </form>

    <table class="sc-default-table">
        <thead>
            <tr>
                <th>{$Think.lang.order_number}</th>
                <th>发货类型</th>
                <th>{$Think.lang.buyer_name}</th>
                <th>{$Think.lang.order_time}</th>
                <th>{$Think.lang.order_total_price}</th>
<!--                <th>订单总佣金</th>-->
<!--                <th>佣金结算状态</th>-->
                <th>{$Think.lang.payment}</th>
                <th>{$Think.lang.order_state}</th>
<!--                <th>下发状态|回执</th>-->
                <th>{$Think.lang.sc_handle}</th>
            </tr>
        </thead>
        {empty  name="order_list"}
        <tbody>
            <tr class="no_data">
                <td colspan="20">{$Think.lang.no_record}</td>
            </tr>
        </tbody>
        {else /}
        <tbody>
            {foreach name="order_list" item="order"}
            <tr>
                <td><a href="javascript:top.scLayerOpen('{:url('Order/show_order',['order_id'=>$order.order_id])}','查看线下订单-{$order.order_sn}')">{$order.order_sn}</a></td>
                <td>{$order.trade_mode|dict_convert="trade_mode",###}</td>
                <td>
                    <a href="javascript:top.scLayerOpen('{:url('Member/member',['member_id' => $order.buyer_id])}','查看用户-{$order.buyer_name}')">{$order.buyer_name}</a>
                </td>
                <td>{$order.add_time|date="Y-m-d H:i:s",###}</td>
                <td>{$order.order_amount}</td>
<!--                <td><a {if $order.commission == 0} style="color:#999"{else} href="{:url('Shop/pointsLog',['order_id' => $order.order_id])}"{/if}">{$order.commission}</a></td>-->
<!--                <td>{$order.commission_state|dict_convert="commission_state",###}</td>-->
                <td>{:get_order_payment_name($order['payment_code'])}</td>
                <td>{:get_order_state($order)}</td>
<!--                <td width="400">-->
<!--                    <div class="block-area">-->
<!--                        万嘉仓库: {$order.wms_state|dict_convert="wms_state",###}-->
<!--                        {if $order.wms_state == $Think.const.WMS_STATE_FAIL}-->
<!--                        |-->
<!--                        <a href="javascript:scLayerConfirm('{:url('Order/change_state',['type_state'=>'wms_state_refresh','order_id'=>$order.order_id])}','是否确定下发错误已解决，并重新执行下发操作')" class="dsui-btn-refresh"><i class="fa"></i>重新下发</a>-->
<!--                        |-->
<!--                        {/if}-->

<!--                        {if in_array($order['wms_state'], [WMS_STATE_ISSUED, WMS_STATE_QUERY])}-->
<!--                        |-->
<!--                        <a href="javascript:scLayerConfirm('{:url('Order/change_state',['type_state'=>'wms_state_undo','order_id'=>$order.order_id])}','是否确定撤回下发')" class="dsui-btn-undo"><i class="fa"></i>撤回</a>-->
<!--                        |-->
<!--                        {/if}-->
<!--                        {$order.wms_msg}-->
<!--                        {if in_array($order['wms_state'], [WMS_STATE_SEND])}-->
<!--                        | 单号：{$order.shipping_code}-->
<!--                        {/if}-->
<!--                    </div>-->
<!--                    <div class="block-area">-->
<!--                        单一窗口: {$order.customs_state|dict_convert="customs_state",###}-->
<!--                        {if $order.customs_state == $Think.const.CUSTOMS_STATE_FAIL}-->
<!--                        |-->
<!--                        <a href="javascript:scLayerConfirm('{:url('Order/change_state',['type_state'=>'customs_state_refresh','order_id'=>$order.order_id])}','是否确定下发错误已解决，并重新执行下发操作')" class="dsui-btn-refresh"><i class="fa"></i>重新下发</a>-->
<!--                        |-->
<!--                        {/if}-->
<!--                        {$order.customs_msg}-->
<!--                    </div>-->
<!--                    <div class="block-area">-->
<!--                        通联支付单: {$order.allinpay_state|dict_convert="allinpay_sync_state",###}-->
<!--                        {if $order.allinpay_state == $Think.const.ALLINPAY_STATE_FAIL}-->
<!--                        |-->
<!--                        <a href="javascript:scLayerConfirm('{:url('Order/change_state',['type_state'=>'allinpay_state_refresh','order_id'=>$order.order_id])}','是否确定下发错误已解决，并重新执行下发操作')" class="dsui-btn-refresh"><i class="fa"></i>重新下发</a>-->
<!--                        |-->
<!--                        {/if}-->
<!--                        {$order.allinpay_msg}-->
<!--                    </div>-->
<!--                    <div class="block-area">-->
<!--                        海关179上报: {$order.platdata_upload_state|dict_convert="platdata_upload_state",###}-->
<!--                        {if $order.platdata_upload_state == $Think.const.PLATDATA_STATE_FAIL}-->
<!--                        |-->
<!--                        <a href="javascript:scLayerConfirm('{:url('Order/change_state',['type_state'=>'platdata_upload_state_refresh','order_id'=>$order.order_id])}','是否确定下发错误已解决，并重新执行下发操作')" class="dsui-btn-refresh"><i class="fa"></i>重新下发</a>-->
<!--                        |-->
<!--                        {/if}-->
<!--                        {$order.platdata_upload_msg}-->
<!--                    </div>-->
<!--                </td>-->
                <td>
                    <a href="javascript:top.scLayerOpen('{:url('Order/show_order',['order_id'=>$order.order_id])}','查看线下订单-{$order.order_sn}')" class="dsui-btn-view"><i class="fa"></i>{$Think.lang.sc_view}</a>
                    {if condition="$order.if_cancel"}
                    <a href="javascript:top.scLayerConfirm('{:url('Order/change_state',['type_state'=>'cancel','order_id'=>$order.order_id])}','{$Think.lang.order_confirm_cancel}')" class="dsui-btn-del"><i class="fa"></i>{$Think.lang.sc_cancel}</a>
                    {/if}

<!--                    <a href="javascript:scLayerOpen('{:url('deliver/buyer_address_edit',['order_id'=>$order.order_id])}','编辑收货信息-{$order.order_id}')" class="dsui-btn-edit"><i class="fa"></i>编辑收货信息</a>-->

<!--                    {if condition="$order.if_system_receive_pay"}-->
<!--                    <a href="javascript:scLayerOpen('{:url('Order/change_state',['type_state'=>'receive_pay','order_id'=>$order.order_id])}','实物订单-{$order.order_sn}')" class="dsui-btn-edit"><i class="fa"></i>{$Think.lang.order_change_received}</a>-->
<!--                    {/if}-->
<!--                    {if isset($order.pintuanorder_state)}-->
<!--                    <p>{$order.pintuanorder_state_text}</p>-->
<!--                    {/if}-->
<!--                    {if isset($order.if_spay_price)}-->
<!--                    <a href="javascript:scLayerOpen('{:url('Order/change_state',['type_state'=>'spay_price','order_id'=>$order.order_id])}','实物订单-{$order.order_sn}')" class="dsui-btn-edit"><i class="fa"></i>{$Think.lang.order_revise_price}</a>-->
<!--                    {/if}-->
                </td>
            </tr>
            {/foreach}
        </tbody>
        {/empty}
    </table>
    {$show_page}
</div>

<script type="text/javascript">
$(function(){
    $('#query_start_time').datepicker({dateFormat: 'yy-mm-dd'});
    $('#query_end_time').datepicker({dateFormat: 'yy-mm-dd'});

});
</script>

